
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<script language="javascript">
    function show(){
 document.getElementById('frmodelid').value ="";
        document.getElementById('frmodelname').value ="";
        document.getElementById('frmodelid').disabled= true;
        document.fr.style.visibility='visible';
         document.getElementById('frinsert').style.visibility='visible';
        document.getElementById('frupdate').style.visibility='hidden';
        document.getElementById('frdelete').style.visibility='hidden';
    }


    function showedit1(element){

        document.fr.style.visibility='visible';
        document.getElementById('frinsert').style.visibility='hidden';
        document.getElementById('frupdate').style.visibility='visible';
        document.getElementById('frdelete').style.visibility='hidden';
        document.getElementById('frmodelid').disabled= true;
        document.getElementById('frmodelid').value = document.getElementById('fr1modelid'+element).value;
        document.getElementById('frmodelname').value = document.getElementById('fr1modelname'+element).value;
         document.getElementById('frmodelidd').value = document.getElementById('fr1modelid'+element).value;

    }
     function showedit2(element){

       document.fr.style.visibility='visible';
        document.getElementById('frinsert').style.visibility='hidden';
        document.getElementById('frupdate').style.visibility='hidden';
        document.getElementById('frdelete').style.visibility='visible';
        document.getElementById('frmodelid').disabled= true;
        document.getElementById('frmodelid').value = document.getElementById('fr1modelid'+element).value;
        document.getElementById('frmodelname').value = document.getElementById('fr1modelname'+element).value;
         document.getElementById('frmodelidd').value = document.getElementById('fr1modelid'+element).value;
    }
    function hiden()
    {
        document.frmMain.txtFid1.disabled = true;
    }
</script>
<p align="right">
                <a href="AdminCar.do?action=listCar" >Car manager</a>&emsp;&emsp;&emsp;
                <a href="AdminCar.do?action=listCarModel" >Model manager</a> &emsp;&emsp;&emsp;
                <a href="AdminCar.do?action=listCarType">Type manager</a>
</p>
<form name="fr1">
   
    <table cellspacing="0" cellpadding="0" border="0" width="100%"><!-- Table -->
        <tr bgcolor="#92949E">
            <td><input type="checkbox"></td>
            <td><font size="2">ModelId</font></td>
            <td><font size="2">ModelName</font></td>
            <td><font size="2">Action</font></td>
        </tr>
        <logic:present name="list">
            <logic:iterate name="list" id="carmodel">
                <tr bgcolor="#F0F0F0">
                    <td><input type ="checkbox"/></td>
                   <td style="background-color:#F0F0F0"><font size="1"><input type="text" style="background-color:#F0F0F0" value="<bean:write name="carmodel" property="modelId"/>"
                                              name="fr1modelid<bean:write name="carmodel" property="modelId"/>"
                                              id="fr1modelid<bean:write name="carmodel" property="modelId"/>" readonly></font></td>
                                              <td><font size="1"><input type="text" style="background-color:#F0F0F0" value="<bean:write name="carmodel" property="modelName"/>"
                                                                       name="fr1modelname<bean:write name="carmodel" property="modelId"/>"
                                                                       id="fr1modelname<bean:write name="carmodel" property="modelId"/>" readonly ></font></td>
                    <td style="background-color:#F0F0F0">
                        <img title="Add" src="admin/img/action_add.png" onclick="show();" style="cursor:pointer">


                        <img title="Edit" src="admin/img/action_remove.png" onclick="showedit1('<bean:write name="carmodel" property="modelId"/>');" style="cursor:pointer">



                        <img title="Delete" src="admin/img/action_delete.png" onclick="showedit2('<bean:write name="carmodel" property="modelId"/>');" style="cursor:pointer">


                    </td>
                </tr>
            </logic:iterate>
        </logic:present>
                    <tr bgcolor="#92949E">
                             <td colspan="4"><font color="#92949E">car id </font></td>

                    </tr>
    </table>
</form>

<form name="fr" style="visibility:hidden" action="AdminCar.do" method="get">
                <table class="tablemain" border="0">
                    <tr >
                        <th height="32" colspan="3" scope="col">Manager CarModel </th>
                    </tr>
                    <tr>
                        <td width="253" height="32"><div align="right">ModelId : </div></td>
                        <td width="510">
                            <input type="text" name="frmodelid" id="frmodelid" />
                            <input type="hidden" name="frmodelidd" id="frmodelidd" />
                        </td>
                    </tr>
                    <tr>
                        <td height="39"><div align="right">ModelName : </div></td>
                        <td><input type="text" name="frmodelname" id="frmodelname"/></td>

                    </tr>
                    <tr>
                        <td height="39" colspan="2"><div align="center">

                                <input type="submit" name="action" value="insertCarmodel" id="frinsert" />
                                 <input type="submit" name="action" value="updateCarmodel" id="frupdate" />
                                  <input type="submit" name="action" value="deleteCartmodel" id="frdelete" />
                            </div>
                        </td>
                    </tr>
                </table>

            </form>

